package com.iyundao.io.Service.Impl;

import com.iyundao.io.Service.ActivityCategoryService;
import com.iyundao.io.mapper.ActivityCategoryMapper;
import com.iyundao.io.model.ActivityCategory;
import com.iyundao.io.tools.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ActivityCategoryServiceImpl implements ActivityCategoryService {

    @Autowired
    private ActivityCategoryMapper activityCategoryMapper;

    @Override
    public ResponseData insert(ActivityCategory activityCategory) {
        if (activityCategory.toString().equals("") || activityCategory.toString() == null) {
            return new ResponseData(0,"传入数据为空");
        } else {
            int i = activityCategoryMapper.insertSelective(activityCategory);
            if (i > 0) {
                return new ResponseData(200,"添加成功");
            } else {
                return new ResponseData(0,"添加失败");
            }
        }
    }

    @Override
    public List<ActivityCategory> findAll() {
        return activityCategoryMapper.findAll();
    }
}
